# coding:utf-8
import pymysql

def init_db():
    conn = pymysql.connect(
        host='127.0.0.1',
        user='root',
	    password='123456',
        db='mytest',
        charset='utf8')
    return conn

if __name__ == '__main__':
    co = init_db()
    cur = co.cursor(cursor=pymysql.cursors.DictCursor)
    num = cur.execute('select password from student where name="%s"' % "admin")
    print num
